package com.github.ecbp.user.service.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.ecbp.common.data.service.BaseService;
import com.github.ecbp.common.req.BaseIdListDTO;
import com.github.ecbp.user.service.dto.AdminLoginDto;
import com.github.ecbp.user.service.dto.AdminQueryDto;
import com.github.ecbp.user.service.dto.PhoneDto;
import com.github.ecbp.user.service.entity.TAdmin;
import com.github.ecbp.user.service.response.AdminRes;
import com.github.ecbp.user.service.vo.AdminPageVo;
import com.github.ecbp.user.service.vo.AdminUserDetails;
import com.github.ecbp.user.service.vo.AdminVo;

import java.util.Set;

/**
 * <p>
 * 后台用户表 服务类
 * </p>
 *
 * @author zj2626
 * @since 2020-03-18
 */
public interface AdminService extends BaseService<TAdmin> {

    IPage<AdminPageVo> page(AdminQueryDto param);

    /**
     * 保存验证码图片
     *
     * @param
     * @return void
     * @author zj2626
     * @date 2020/5/12
     */
    void saveImageCode();

    /**
     * 用户登录
     *
     * @param param
     * @return java.lang.String
     * @author zj2626
     * @date 2020/5/12
     */
    String login(AdminLoginDto param);

    /**
     * 获得用户信息, 返回UserDetails类型
     *
     * @param loginPhone
     * @return com.ecbp.service.user.vo.AdminUserDetails
     * @author zj2626
     * @date 2020/5/28
     */
    AdminUserDetails loadUserByLoginPhone(String loginPhone);

    /**
     * 重新加载缓存中的用户权限
     *
     * @param loginPhones
     * @return void
     * @author zj2626
     * @date 2020/5/12
     */
    void reloadUserPermission(Set<String> loginPhones);

    /**
     * 退出登录
     *
     * @param
     * @return void
     * @author zj2626
     * @date 2020/5/12
     */
    void logout();

    /**
     * 注销登录
     *
     * @param param
     * @return void
     * @author zj2626
     * @date 2020/5/12
     */
    void logout(BaseIdListDTO param);

    AdminVo getById(Long id);

    /**
     * 发送验证码
     *
     * @param param
     * @return java.lang.String
     * @author zj2626
     * @date 2020/5/12
     */
    String sendVerification(PhoneDto param);

    /**
     * 获取指定ID用户信息
     *
     * @param id
     * @return com.github.ecbp.user.service.response.AdminRes
     * @author zj2626
     * @date 2020/5/12
     */
    AdminRes getAdminInfoById(Long id);
}
